#include "bsp_Pwm.h"
#include "sys_Debug.h"
#include "tim.h"

void bsp_Pwm::init()
{
    TIM->Init.Prescaler = Prescaler;
    TIM->Init.Period = Period;
    BSP_TIM_PWM_Init(TIM);
    setCompare(0);
}

void bsp_Pwm::setCompare(uint32_t compare)
{
    Compare = compare;
    BSP_TIM_Set_Compare(TIM, Channel, Compare);
}

#if DEMO_PWM
bsp_Pwm demoPwm(&htim3, TIM_CHANNEL_1, 71, 25);
#endif
